﻿using System;
using FBGraph.Models;

namespace FBGraph.Controllers
{
    public partial class FeedController
    {
        /// <summary>Writes an item on the targeted profile's wall.</summary>
        /// <param name="targetProfileId">The Graph API identifier of the profile whose wall will be written on. This can be the id of a <see cref="User" /> or <see cref="Page" />.</param>
        /// <param name="message">User-specified message to write.</param>
        /// <param name="picture">An optional url for a picture to include with the posting.</param>
        /// <param name="link">An optional url for a link to include with the posting.</param>
        /// <param name="name">An optional name for the link or picture.</param>
        /// <param name="description">An optional description of the link or picture.</param>
        /// <returns>The identifier of the message that was posted.</returns>
        public Object Write(Int64? targetProfileId, String message, String picture, String link, String name, String description)
        {
            var args = new FBArgs
            {
                { "message", message },
                { "picture", picture },
                { "link", link },
                { "name", name },
                { "description", description }
            };

            var result = Context.Post((Object)targetProfileId ?? "me", "feed", args);

            return result.Id;
        }
    }
}